﻿using GetSmartIDEList.Core.Ulities;
using GetSmartIDEList.Lib.Common;
using GetSmartIDEList.Lib.ORM;
using GetSmartIDEList.Models;
using GetSmartIDEList.WebAPI.Common;
using GetSmartIDEList.WebAPI.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Nancy.Json;
using Newtonsoft.Json;
using System.Text;

namespace GetSmartIDEList.Controllers
{
    /// <summary>
    /// 获取IDE所有数据的接口
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class GetIDECodeListController : ControllerBase
    {
        [HttpGet(template: "{id}")]
        public IEnumerable<resultData> Get(string id)
        {
            return ReposFunction.GetAllRepos(id);

            //。。。。。。
            //return CreatedAtAction("GetIDECodeList", "", ReposFunction.GetAllRepos(id));

            //string jsonStr = JsonConvert.SerializeObject(ReposFunction.GetAllRepos(id));
            //return new ContentResult { Content = jsonStr, ContentType = "application/json" };

            //JavaScriptSerializer serializer = new JavaScriptSerializer();
            //string str = serializer.Serialize(ReposFunction.GetAllRepos(id));

            //HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json") };
            //return result;
        }
    }
}
